//
//  GlideView.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/6/11.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class GlideView: UIView {
    let kwidth:CGFloat = (kSCREEN_WIDTH*0.6)/5 //间距
    lazy var cornerView:UIView = {
        let view = UIView()
        view.layer.cornerRadius = 5
        view.layer.masksToBounds = true
        view.backgroundColor = UIColor(hexStr: "#e6e8e8")
        return view
    }()
    lazy var sliderView:UIView = {
        let view = UIView()
        view.layer.cornerRadius = 2
        view.backgroundColor = UIColor(hexStr: "#e6e8e8")
        view.layer.masksToBounds = true
        return view
    }()
    lazy var progressView:UIView = {
        let view = UIView()
        view.layer.cornerRadius = 2
        view.backgroundColor = UIColor(hexStr:"#3cb265")
        return view
    }()
    override init(frame: CGRect) {
        super.init(frame: CGRect.zero)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func setUpUI() {
        self.addSubview(cornerView)
        cornerView.snp.makeConstraints({ (make) in
            make.left.equalToSuperview()
            make.centerY.equalToSuperview()
            make.height.width.equalTo(10)
        })
        
        self.addSubview(sliderView)
        sliderView.snp.makeConstraints { (make) in
            make.left.equalTo(cornerView.snp.right).offset(3)
            make.right.equalToSuperview().offset(-3)
            make.centerY.equalToSuperview()
            make.height.equalTo(4)
        }
        
        self.addSubview(progressView)
        progressView.snp.makeConstraints { (make) in
            make.left.equalTo(sliderView)
            make.width.equalTo(0)
            make.centerY.equalToSuperview()
            make.height.equalTo(4)
        }
        
    }
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
